# To change this template, choose Tools | Templates
# and open the template in the editor.

from Tkinter import *
import os
#The Name Dialog acquires the user's name and saves it to the system
class Dialog:
        def __init__(self, parent, title):

            self.parent = parent
            top = self.top = Toplevel(parent)
            Label(top, text=title).pack()
            self.entry = Entry(top)
            self.entry.pack(padx=5)

            button = Button(top, text="Done!", command=self.done)
            button.pack(side=LEFT)

            cnclButton = Button(top, text="Cancel", command=self.cancel)
            cnclButton.pack(side=RIGHT)
            
            self.return_value = "Name"
            
            os.system('matchbox-keyboard&')

        def done(self):
            os.system('killall matchbox-keyboard')
            if (self.entry.get()!=""):
                self.return_value = self.entry.get()
            self.top.destroy()

        def cancel(self):
            os.system('killall matchbox-keyboard')
            self.top.destroy()

        def returnValue(self):
            self.parent.wait_window(self.top)
            return self.return_value
